﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DLMemberPointMS.Entity.POCOModel;
using DLMemberPointMS.Entity.ViewModel;
using DLMemberPointMS.Common;
//using System.Web.Mvc;

namespace DLMemberPointMS.Business
{
    public class LExchangLogsService : BaseService<ExchangLogs>
    {

        #region ExchangGifts列表查询
        public OperateResult GetExGift(string MC_CardID, PageViewModels pageview)
        {
            var query = PredicateExtensions.True<ExchangLogs>();
            if (!string.IsNullOrWhiteSpace(MC_CardID))
            {
                query = query.And(e => e.MC_CardID == MC_CardID);
            }

            int rowCount = 0;//总行数
            var list = GetList(pageview.page, pageview.limit, ref rowCount, query, e => e.EL_ID, true)
                .Select(c => new
                {
                    c.EG_GiftCode,
                    c.EG_GiftName,
                    c.EG_ID,
                    c.EL_CreateTime,
                    c.EL_ID,
                    c.EL_Number,
                    c.EL_Point,
                    c.MC_CardID
                }).ToList();

            if (list == null)
            {
                return new OperateResult(code.Error, "没有数据哟！");
            }
            else
            {
                return new OperateResult(code.Success,  "查询成功", list,rowCount);

            }

        }
        #endregion
    }
}
